
# with cmake build, always check for .so up
pkgname=libarchive
pkgver=3.3.2
_pkgver=3.3.2
pkgrel=1
pkgdesc="library that can create and read several streaming archive formats"
arch=('x86_64')
url="http://libarchive.org/"
license=('BSD')
depends=('zlib' 'bzip2' 'xz' 'acl' 'openssl' 'expat' 'lzo2' 'attr')
makedepends=('cmake' 'clang')
source=("https://github.com/libarchive/libarchive/archive/v${_pkgver}.tar.gz")
md5sums=('a3acebe237f89d7f31c5bb1da5e843c7')

build() {
  mkdir -p build
  cd build
  
  export CC=/usr/bin/clang
  export CXX=/usr/bin/clang++
  
  cmake ../${pkgname}-${_pkgver} \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DENABLE_LIBXML2=OFF \
    -DENABLE_LZO=ON

  make
}

check() {
  cd build
  
  make test
}

package() {
  cd build
  make DESTDIR=${pkgdir} install

  install -D -m644 ../${pkgname}-${_pkgver}/COPYING ${pkgdir}/usr/share/licenses/libarchive/COPYING
}
